package com.abigdreamer.im.test;

public class T {
	public static void main(String[] args) {
		Thread currentThread=Thread.currentThread();   
		ThreadGroup currentThreadGroup=currentThread.getThreadGroup();   
		ThreadGroup topThreadGroup=currentThreadGroup;   
		while (topThreadGroup.getParent() != null) {   
		    topThreadGroup = topThreadGroup.getParent();   
		}   
		Thread[] allThreadArray = new Thread[1000];   
		topThreadGroup.enumerate(allThreadArray);   
		for(Thread thread:allThreadArray){   
		    if(thread!=null){   
		        System.out.println("Group: "+thread.getThreadGroup().getName());   
		        System.out.println("ID: "+thread.getId());   
		        System.out.println("线程: "+thread.getName());   
		        for(StackTraceElement stackElement:thread.getStackTrace()){   
		            System.out.println(stackElement.toString());   
		        }   
		        System.out.println("状态: "+thread.getState().name());   
		        System.out.println("Priority: "+thread.getPriority());   
		        System.out.println("是否后台线程: "+thread.isDaemon());   
		        System.out.println("------------------------");   
		    }   
		}  
		
	}
}
